#from cms.cython_support cimport * #@cy

cdef public object BytesIO
cdef public object datetime
cdef public object dt_timezone

cdef public str UPPERCASE
cdef public str LOWERCASE
cdef public str NUMBERS

cdef ExBool_t isiterable(object obj) except ExBool_val
cdef _Bool findNot(str string, str template, int64_t idx)
cdef _Bool findAny(str string, str template, int64_t idx)
cdef str htmlEscape(str string)
cdef _Bool stringBool(str string, _Bool default)

cdef inline void str2carray(Py_UCS4 *carray, str string, Py_ssize_t arrayLen):
	cdef Py_ssize_t count
	cdef Py_ssize_t i
	if arrayLen > 0:
		count = min(len(string), arrayLen - 1)
		for i in range(count):
			carray[i] = string[i]
		carray[count] = 0

cdef inline str carray2str(const Py_UCS4 *carray, Py_ssize_t arrayLen):
	cdef str ret = ""
	cdef Py_ssize_t i
	cdef Py_UCS4 c
	if arrayLen > 0:
		for i in range(arrayLen - 1):
			c = carray[i]
			if c == 0:
				break
			ret += c
	return ret

cdef class FSHelpers(object):
	cdef str __pathSep
	cdef object __os_stat
	cdef object __os_listdir
	cdef object __stat_S_ISDIR

	cdef str __mkpath(self, tuple path_elements)
	cdef _Bool __exists(self, tuple path_elements)
	cdef _Bool __exists_nonempty(self, tuple path_elements)
	cdef str __read(self, tuple path_elements)
	cdef object __read_int(self, tuple path_elements)
	cdef object __mtime(self, tuple path_elements)
	cdef object __mtime_nofail(self, tuple path_elements)
	cdef list __subdirList(self, tuple path_elements)

cdef public FSHelpers fs
